<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019\2\23 0023
 * Time: 16:18
 */

namespace app\Lib\Ioc\LotteryQualification;


use app\Lib\Model\LotteryQualification\LotteryQualificationOperate;
use app\Lib\Model\User\User;
use think\Db;

class AddLotteryQualification
{
    public function run($data){
        return Db::transaction(function ()use($data){
            $model = (new LotteryQualificationOperate());
            $model->setOpUser(new User($data['opUser']));
            $model->setLotteryType($data['lotteryType']);
            $model->setNum();
            if(!empty($data['num'])){
                $model->setNum($data['num']);
            }
            $model->setUserMobile($data['userMobile']);
            return $model->add();
        });
    }

}